<template>
    <view>
        <view class="list_header">
            <view
                @tap="tabClick"
                :class="'list_title ' + (activeIndex == index ? 'selsect' : 'default')"
                :id="index"
                :style="'color:' + (activeIndex == index ? color : '')"
                v-for="(item, index) in tabs"
                :key="index"
            >
                <view>{{ item }}</view>

                <view class="list_border" v-if="activeIndex == index" :style="'background-color:' + color + ';'"></view>
            </view>
        </view>
        <view class="list" v-if="activeIndex == 0">
            <view class="list_imgbk2" v-if="dsh.length == 0">
                <image class="list_imgbk" mode="aspectFit" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/list.png"></image>
                <view class="list_imgbk3">您暂时没有待审核的明细哦！</view>
            </view>
            <view class="weui-cells weui-cells_after-title" v-for="(item, index) in dsh" :key="index">
                <view class="weui-cell">
                    <view class="weui-cell__bd">申请时间：{{ item.time }}</view>
                    <view class="weui-cell__ft" style="color: #999">等待审核</view>
                </view>

                <view class="weui-cell">
                    <view class="weui-cell__hd">
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/zfb.png" v-if="item.type == '1'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/weixin.png" v-if="item.type == '2'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/yhk.png" v-if="item.type == '3'"></image>
                    </view>
                    <view class="weui-cell__bd">
                        <view>{{ item.user_name }}({{ item.account }})</view>
                        <view>提现金额：{{ item.tx_cost }}元</view>
                    </view>
                    <view class="weui-cell__ft">预计到账金额：{{ item.sj_cost }}</view>
                </view>
            </view>
            <view class="kong" v-if="dsh.length != 0">
                <image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
                <view>没有更多了</view>
            </view>
        </view>
        <view class="list" v-if="activeIndex == 1">
            <view class="list_imgbk2" v-if="ytg.length == 0">
                <image class="list_imgbk" mode="aspectFit" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/list.png"></image>
                <view class="list_imgbk3">您暂时没有已通过的明细哦！</view>
            </view>
            <view class="weui-cells weui-cells_after-title" v-for="(item, index) in ytg" :key="index">
                <view class="weui-cell">
                    <view class="weui-cell__bd">通过时间：{{ item.sh_time }}</view>
                    <view class="weui-cell__ft" style="color: #34aaff">提现成功</view>
                </view>

                <view class="weui-cell">
                    <view class="weui-cell__hd">
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/zfb.png" v-if="item.type == '1'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/weixin.png" v-if="item.type == '2'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/yhk.png" v-if="item.type == '3'"></image>
                    </view>
                    <view class="weui-cell__bd">
                        <view>{{ item.user_name }}({{ item.account }})</view>
                        <view>提现金额：{{ item.tx_cost }}元</view>
                    </view>
                    <view class="weui-cell__ft">预计到账金额：{{ item.sj_cost }}</view>
                </view>
            </view>
            <view class="kong" v-if="ytg.length != 0">
                <image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
                <view>没有更多了</view>
            </view>
        </view>
        <view class="list" v-if="activeIndex == 2">
            <view class="list_imgbk2" v-if="yjj.length == 0">
                <image class="list_imgbk" mode="aspectFit" src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/list.png"></image>
                <view class="list_imgbk3">您暂时没有已拒绝的明细哦！</view>
            </view>
            <view class="weui-cells weui-cells_after-title" v-for="(item, index) in yjj" :key="index">
                <view class="weui-cell">
                    <view class="weui-cell__bd">审核时间：{{ item.sh_time }}</view>
                    <view class="weui-cell__ft" style="color: #ff6161">已被拒绝</view>
                </view>

                <view class="weui-cell">
                    <view class="weui-cell__hd">
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/zfb.png" v-if="item.type == '1'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/weixin.png" v-if="item.type == '2'"></image>
                        <image class="himg" src="https://ymqycc.oss-cn-chengdu.aliyuncs.com/ymqzho2o/static/ymq_canyino2o/images/yhk.png" v-if="item.type == '3'"></image>
                    </view>
                    <view class="weui-cell__bd">
                        <view>{{ item.user_name }}({{ item.account }})</view>
                        <view>提现金额：{{ item.tx_cost }}元</view>
                    </view>
                    <view class="weui-cell__ft">预计到账金额：{{ item.sj_cost }}</view>
                </view>
            </view>
            <view class="kong" v-if="yjj.length != 0">
                <image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/wushuju.png"></image>
                <view>没有更多了</view>
            </view>
        </view>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
var util = require('../../utils/util.js');
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            tabs: ['待审核', '已通过', '已拒绝'],
            activeIndex: 0,
            dsh: '',
            ytg: '',
            yjj: '',
            color: ''
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        this.reLoad();
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {
        this.reLoad();
    },
    onReachBottom: function () {},
    methods: {
        tabClick: function (t) {
            this.setData({
                activeIndex: t.currentTarget.id
            });
        },

        reLoad: function () {
            var that = this;
            var t = uni.getStorageSync('users').id;
            app.globalData.util.request({
                url: 'entry/wxapp/YjtxList',
                cachetime: '0',
                data: {
                    user_id: t
                },
                success: function (t) {
                    console.log(t.data);
                    for (var a = 0; a < t.data.length; a++) {
                        t.data[a].time = util.ormatDate(t.data[a].time);
                        t.data[a].sh_time = util.ormatDate(t.data[a].sh_time);
                    }
                    var e = [];
                    var o = [];
                    var n = [];
                    for (a = 0; a < t.data.length; a++) {
                        if ('1' == t.data[a].state) {
                            e.push(t.data[a]);
                        }
                        if ('2' == t.data[a].state) {
                            o.push(t.data[a]);
                        }
                        if ('3' == t.data[a].state) {
                            n.push(t.data[a]);
                        }
                    }
                    console.log(e, o, n);
                    that.setData({
                        dsh: e,
                        ytg: o,
                        yjj: n
                    });
                }
            });
        }
    }
};
</script>
<style>
@import './detault.css';
</style>
